package org.imaginedays.java.design.patter.strategy;

public class CashReturn extends CashSuper {
	
	private double moneyCondition;
	private double moneyReturn;
	
	

	public CashReturn(String moneyCondition, String moneyReturn) {
		super();
		this.moneyCondition = Double.parseDouble(moneyCondition);
		this.moneyReturn =  Double.parseDouble(moneyReturn);
	}



	@Override
	public double acceptCash(double money) {
		double result = 0.0d;
		if (money>= moneyCondition){
			result = money - Math.floor(money/moneyCondition)*moneyReturn;
		}else{
			result = money;
		}
		return result;
	}

}
